package com.twu.biblioteca.model;

import com.google.inject.Inject;

import com.twu.biblioteca.dao.UserDao;
import com.twu.biblioteca.entity.User;

public class UserModel {
  private final UserDao dao;

  @Inject
  public UserModel(UserDao dao) {
    this.dao = dao;
  }

  public boolean checkCredential(String libraryNumber, String password) {
    User user = this.dao.findWithLibraryNumber(libraryNumber);
    return user.getPassword().equals(password);
  }

  public User findWithLibraryNumber(String libraryNumber) {
    return this.dao.findWithLibraryNumber(libraryNumber);
  }
}
